package com.xcw.bos.web.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.xcw.bos.crm.Customer;
import com.xcw.bos.crm.CustomerService;
import com.xcw.bos.domain.Noticebill;
import com.xcw.bos.utils.BosContext;
import com.xcw.bos.web.action.base.BaseAction;

/**
 * 业务受理---业务通知单操作
 * @author xcw
 *
 */
@Controller
@Scope("prototype")
public class NoticebillAction extends BaseAction<Noticebill>{
    //接收手机号
	private String phone;
	
	//注入代理对象，远程访问crm
	@Resource
	private CustomerService customerService;
	
	//根据手机号查询客户信息
	public String findCustomerByPhone(){
		Customer customer = customerService.findCustomerByPhone(phone);
		String[] excudes = new String[]{};
		this.writeObject2Json(excudes, customer);
		return NONE;
	}
	
	//保存业务通知单，并自动分单
	public String save(){
		noticebillService.save(model, BosContext.getLoginUser().getId());
		return "saveUI";
	}
	
	public void setPhone(String phone){
		this.phone = phone;
	}
}
